<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页 - 日本公司CMS</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">日本公司</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link active" href="/">首页</a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="businessDropdown" role="button" data-bs-toggle="dropdown">
                            业务服务
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="/business/study-abroad">留学服务</a></li>
                            <li><a class="dropdown-item" href="/business/labor-dispatch">劳务派遣</a></li>
                            <li><a class="dropdown-item" href="/business/it-service">IT服务</a></li>
                        </ul>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/articles">文章资讯</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/about">关于我们</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/contact">联系我们</a>
                    </li>
                </ul>
                <div class="d-flex">
                    <a href="/admin/login" class="btn btn-outline-light me-2">登录</a>
                    <a href="/admin/register" class="btn btn-primary">注册</a>
                </div>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <main class="main-content">
        <!-- 轮播图 -->
        <div id="mainCarousel" class="carousel slide" data-bs-ride="carousel" th:if="${#lists.isEmpty(topArticles)}">
            <div class="carousel-indicators">
                <button type="button" data-bs-target="#mainCarousel" data-bs-slide-to="0" class="active"></button>
                <button type="button" data-bs-target="#mainCarousel" data-bs-slide-to="1"></button>
                <button type="button" data-bs-target="#mainCarousel" data-bs-slide-to="2"></button>
            </div>
            <div class="carousel-inner">
                <div class="carousel-item active">
                    <img src="https://via.placeholder.com/1200x500/007bff/ffffff?text=留学服务" class="d-block w-100" alt="留学服务">
                    <div class="carousel-caption d-none d-md-block">
                        <h2>专业留学服务</h2>
                        <p>为您提供全方位的日本留学解决方案</p>
                    </div>
                </div>
                <div class="carousel-item">
                    <img src="https://via.placeholder.com/1200x500/28a745/ffffff?text=劳务派遣" class="d-block w-100" alt="劳务派遣">
                    <div class="carousel-caption d-none d-md-block">
                        <h2>劳务派遣服务</h2>
                        <p>连接优秀人才与日本企业</p>
                    </div>
                </div>
                <div class="carousel-item">
                    <img src="https://via.placeholder.com/1200x500/dc3545/ffffff?text=IT服务" class="d-block w-100" alt="IT服务">
                    <div class="carousel-caption d-none d-md-block">
                        <h2>IT技术服务</h2>
                        <p>专业的IT解决方案提供商</p>
                    </div>
                </div>
            </div>
            <button class="carousel-control-prev" type="button" data-bs-target="#mainCarousel" data-bs-slide="prev">
                <span class="carousel-control-prev-icon"></span>
            </button>
            <button class="carousel-control-next" type="button" data-bs-target="#mainCarousel" data-bs-slide="next">
                <span class="carousel-control-next-icon"></span>
            </button>
        </div>

        <!-- 置顶文章轮播 -->
        <div id="topArticlesCarousel" class="carousel slide" data-bs-ride="carousel" th:unless="${#lists.isEmpty(topArticles)}">
            <div class="carousel-indicators" th:each="article, iterStat : ${topArticles}">
                <button type="button" data-bs-target="#topArticlesCarousel" th:data-bs-slide-to="${iterStat.index}" th:classappend="${iterStat.first} ? 'active'"></button>
            </div>
            <div class="carousel-inner">
                <div class="carousel-item" th:each="article, iterStat : ${topArticles}" th:classappend="${iterStat.first} ? 'active'">
                    <img src="https://via.placeholder.com/1200x500/6f42c1/ffffff?text=置顶文章" class="d-block w-100" alt="置顶文章">
                    <div class="carousel-caption d-none d-md-block">
                        <h2 th:text="${article.title}">置顶文章标题</h2>
                        <p th:text="${#strings.abbreviate(article.summary, 100)}">文章摘要...</p>
                        <a th:href="@{/articles/{id}(id=${article.id})}" class="btn btn-light">阅读全文</a>
                    </div>
                </div>
            </div>
            <button class="carousel-control-prev" type="button" data-bs-target="#topArticlesCarousel" data-bs-slide="prev">
                <span class="carousel-control-prev-icon"></span>
            </button>
            <button class="carousel-control-next" type="button" data-bs-target="#topArticlesCarousel" data-bs-slide="next">
                <span class="carousel-control-next-icon"></span>
            </button>
        </div>

        <!-- 服务介绍 -->
        <section class="py-5">
            <div class="container">
                <div class="row">
                    <div class="col-12 text-center mb-5">
                        <h2>我们的服务</h2>
                        <p class="lead">为您提供专业的日本相关服务</p>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-4 mb-4">
                        <div class="card h-100">
                            <img src="https://via.placeholder.com/400x250/007bff/ffffff?text=留学服务" class="card-img-top" alt="留学服务">
                            <div class="card-body">
                                <h5 class="card-title">留学服务</h5>
                                <p class="card-text">提供日本留学咨询、申请指导、签证办理等全方位服务，助您实现留学梦想。</p>
                                <a href="/business/study-abroad" class="btn btn-primary">了解更多</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4 mb-4">
                        <div class="card h-100">
                            <img src="https://via.placeholder.com/400x250/28a745/ffffff?text=劳务派遣" class="card-img-top" alt="劳务派遣">
                            <div class="card-body">
                                <h5 class="card-title">劳务派遣</h5>
                                <p class="card-text">专业的劳务派遣服务，为日本企业提供优质人才，为求职者提供理想工作机会。</p>
                                <a href="/business/labor-dispatch" class="btn btn-primary">了解更多</a>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4 mb-4">
                        <div class="card h-100">
                            <img src="https://via.placeholder.com/400x250/dc3545/ffffff?text=IT服务" class="card-img-top" alt="IT服务">
                            <div class="card-body">
                                <h5 class="card-title">IT服务</h5>
                                <p class="card-text">提供软件开发、系统集成、技术咨询等专业IT服务，助力企业数字化转型。</p>
                                <a href="/business/it-service" class="btn btn-primary">了解更多</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 推荐文章 -->
        <section class="py-5 bg-light" th:unless="${#lists.isEmpty(recommendArticles)}">
            <div class="container">
                <div class="row">
                    <div class="col-12 text-center mb-5">
                        <h2>推荐文章</h2>
                        <p class="lead">精选优质内容，为您提供有价值的信息</p>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6 mb-4" th:each="article : ${recommendArticles}">
                        <div class="card h-100">
                            <div class="card-body">
                                <h5 class="card-title" th:text="${article.title}">推荐文章标题</h5>
                                <p class="card-text" th:text="${#strings.abbreviate(article.summary, 120)}">文章摘要内容...</p>
                                <div class="d-flex justify-content-between align-items-center">
                                    <small class="text-muted" th:text="${#temporals.format(article.createTime, 'yyyy-MM-dd')}">2024-01-15</small>
                                    <a th:href="@{/articles/{id}(id=${article.id})}" class="btn btn-sm btn-outline-primary">阅读全文</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 公司简介 -->
        <section class="py-5 bg-light">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-md-6">
                        <h2>关于我们</h2>
                        <p>我们是一家专业的日本服务提供商，致力于为客户提供优质的留学、劳务派遣和IT服务。</p>
                        <p>凭借丰富的经验和专业的团队，我们已经帮助众多客户实现了他们的目标。</p>
                        <a href="/about" class="btn btn-outline-primary">了解更多</a>
                    </div>
                    <div class="col-md-6">
                        <img src="https://via.placeholder.com/600x400/6c757d/ffffff?text=公司介绍" class="img-fluid rounded" alt="公司图片">
                    </div>
                </div>
            </div>
        </section>

        <!-- 最新资讯 -->
        <section class="py-5">
            <div class="container">
                <div class="row">
                    <div class="col-12 text-center mb-5">
                        <h2>最新资讯</h2>
                        <p class="lead">了解最新的行业动态和公司新闻</p>
                    </div>
                </div>
                <div class="row" th:if="${#lists.isEmpty(latestArticles)}">
                    <div class="col-12">
                        <div class="alert alert-info text-center">
                            <i class="bi bi-info-circle"></i> 暂无最新资讯
                        </div>
                    </div>
                </div>
                <div class="row" th:unless="${#lists.isEmpty(latestArticles)}">
                    <div class="col-md-4 mb-4" th:each="article : ${latestArticles}">
                        <div class="card h-100">
                            <div class="card-body">
                                <h5 class="card-title" th:text="${article.title}">文章标题</h5>
                                <p class="card-text" th:text="${#strings.abbreviate(article.summary, 80)}">文章摘要...</p>
                                <small class="text-muted" th:text="${#temporals.format(article.createTime, 'yyyy-MM-dd')}">2024-01-15</small>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="text-center">
                    <a href="/articles" class="btn btn-primary">查看更多</a>
                </div>
            </div>
        </section>
    </main>

    <!-- 页脚 -->
    <footer class="bg-dark text-light py-4 mt-5">
        <div class="container">
            <div class="row">
                <div class="col-md-4">
                    <h5>关于我们</h5>
                    <p>专业的日本服务提供商，致力于为客户提供优质的留学、劳务派遣和IT服务。</p>
                </div>
                <div class="col-md-4">
                    <h5>快速链接</h5>
                    <ul class="list-unstyled">
                        <li><a href="/" class="text-light">首页</a></li>
                        <li><a href="/business/study-abroad" class="text-light">留学服务</a></li>
                        <li><a href="/business/labor-dispatch" class="text-light">劳务派遣</a></li>
                        <li><a href="/business/it-service" class="text-light">IT服务</a></li>
                    </ul>
                </div>
                <div class="col-md-4">
                    <h5>联系我们</h5>
                    <p><i class="bi bi-telephone"></i> +81-XX-XXXX-XXXX</p>
                    <p><i class="bi bi-envelope"></i> info@japan-company.com</p>
                    <p><i class="bi bi-geo-alt"></i> 日本东京都XX区XX町XX番地</p>
                </div>
            </div>
            <hr class="my-4">
            <div class="text-center">
                <p>&copy; 2024 日本公司. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="/js/main.js"></script>
</body>
</html>